<div class="toolbar_buttons">
  <%= render "alchemy/admin/partials/site_select" %>
  <%= render "alchemy/admin/partials/language_tree_select" %>
  <%= render Alchemy::Admin::ToolbarButton.new(
    icon: "file-add",
    url: alchemy.new_admin_page_path(language: @current_language),
    hotkey: 'alt+n',
    tooltip_placement: "top-start",
    dialog_options: {
      title: Alchemy.t('Add a page'),
      size: '420x215',
      overflow: true
    },
    label: Alchemy.t('Add a page'),
    if_permitted_to: [:create, Alchemy::Page]
  ) %>
  <div class="toolbar_spacer"></div>
  <% if can?(:flush, Alchemy::Page) %>
    <div class="toolbar_button">
      <sl-tooltip content="<%= Alchemy.t("Flush page cache") %>">
        <%= button_to(
          render_icon(:eraser),
          alchemy.flush_admin_pages_path,
          "turbo-method": :post,
          class: "icon_button please_wait"
        ) %>
      </sl-tooltip>
    </div>
  <% end %>
  <%= render "alchemy/admin/clipboard/button", remarkable_type: "pages" %>
  <div class="toolbar_spacer"></div>
  <div class="toolbar_button">
    <sl-tooltip content="<%= Alchemy.t("Hierarchical") %>">
      <%= link_to(
        render_icon(:"menu-2"),
        alchemy.admin_pages_path(view: "tree"),
        class: ["icon_button", @view != "list" && "active"].compact
      ) %>
    </sl-tooltip>
  </div>
  <div class="toolbar_button">
    <sl-tooltip content="<%= Alchemy.t("Sortable List") %>">
      <%= link_to(
        render_icon("sort-desc", style: false),
        alchemy.admin_pages_path(view: "list"),
        class: ["icon_button", @view == "list" && "active"].compact
      ) %>
    </sl-tooltip>
  </div>
</div>
<% search_filter_params[:view] = "list" %>
<%= render "alchemy/admin/partials/search_form",
  url: alchemy.admin_pages_path(search_filter_params.except(:q, :page)),
  additional_params: [:view] %>
